﻿<UserControl x:Class="MMLib.WPF.View.MessageBoxView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:converters="clr-namespace:MMLib.WPF.Converters"
             MaxWidth="450"
             mc:Ignorable="d">
    <Grid>
        <Grid.Resources>
            <converters:MessageBoxImageConverter x:Key="messageBoxImageConverter" />            
        </Grid.Resources>
        <Border VerticalAlignment="Center" 
                BorderBrush="{StaticResource ResourceKey=messageBoxBorderBrush}"                 
                BorderThickness="1"
                Background="White"
                Grid.RowSpan="2"
                Opacity="1">
            <Grid Margin="5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="84" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition MinHeight="84" />
                    <RowDefinition />
                </Grid.RowDefinitions>

                <Image Grid.Column="0" Grid.Row="0" 
                       MaxWidth="64" MaxHeight="64" 
                       Source="{Binding Path=Image, Converter={StaticResource ResourceKey=messageBoxImageConverter}}" />

                <TextBlock Grid.Column="1" 
                           Margin="10"
                           Text="{Binding Path=Message}"
                           TextWrapping="Wrap"/>

                <ItemsControl ItemsSource="{Binding Path=Commands}"
                              Grid.ColumnSpan="2" Grid.Row="1"
                              HorizontalAlignment="Center">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal"/>
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Button Content="{Binding Path=DisplayName}" Command="{Binding Path=.}"
                                    Padding="10,5"
                                    Margin="10"/>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </Grid>
        </Border>
    </Grid>
</UserControl>
